<?php
function write_file($filename) {
    $filenamePHP = $filename . ".php";
    if (is_file("../graficas/" .$filenamePHP)) {
        ob_start();
        include "../graficas/" .$filenamePHP;
        $contents = ob_get_contents();
        $filenamePNG = $filename . ".png";
        $handle = fopen("../graficas/" .$filenamePNG, 'w+'); 
        @fwrite($handle, $contents);  
         fclose($handle);
        return ;
    }
    return false;
}
?>

